/**
 * 
 */
package complexes;

/**
 * @author valentin
 *
 */
public class ExpoComplexe implements Complexe
{
	private double rho;
	private Angle theta;
	
	public ExpoComplexe(double rho, Angle theta)
	{
		this.rho = rho;
		this.theta = theta;
	}

	/* (non-Javadoc)
	 * @see complexes.Complexe#getRe()
	 */
	@Override
	public double getRe()
	{
		return rho * Math.cos(theta.getAngle());
	}

	/* (non-Javadoc)
	 * @see complexes.Complexe#getIm()
	 */
	@Override
	public double getIm()
	{
		return rho * Math.sin(theta.getAngle());
	}

	/* (non-Javadoc)
	 * @see complexes.Complexe#getModule()
	 */
	@Override
	public double getModule() {
		return rho;
	}

	/* (non-Javadoc)
	 * @see complexes.Complexe#getArgument()
	 */
	@Override
	public Angle getArgument() {
		return theta;
	}
	
	public boolean equals(Object o)
	{
		if(!(o instanceof Complexe))
			return false;
		else
			return rho == ((Complexe)o).getModule() && theta.equals(((Complexe)o).getArgument());
	}
	
	public String toString()
	{
		return "z = " + rho + ".e^i." + theta;
	}
}
